/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package researchgrants.parts.LoggedData;


/**
 *
 * @author DOStudent1
 */
public class LoggedLogableString implements LoggedLogableObject{

    private String loggedString;
    private boolean isSet=false;
    
    public LoggedLogableObject fromLogableObject(LogableObject logableString) {
        LoggedLogableString loggedLogableString=new LoggedLogableString();
        if (logableString.isEmpty()) {
            loggedLogableString.loggedString="";
            loggedLogableString.isSet=true;
        } else { 
            String value=((LogableString)logableString).getString();
            loggedLogableString.loggedString=value;
            loggedLogableString.isSet=true;
        }
        return(loggedLogableString);
    }
    
    public LogableObject toLogableObject() {
        if (!isSet) {
            throw new RuntimeException("Not initialized");
        }
        return(new LogableString().fromString(loggedString));
    }

    public String toLoggedValue() {
        if (!isSet) {
            throw new RuntimeException("Not initialized");
        }
        return(loggedString);
    }

    public LoggedLogableObject fromLoggedValue(String loggedValue) {
        LoggedLogableString loggedMyObject=new LoggedLogableString();
        loggedMyObject.loggedString=loggedValue;
        loggedMyObject.isSet=true;
        return(loggedMyObject);
    }
}
